package steed.sample.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;

import steed.util.UtilsUtil;
import steed.util.base.BaseUtil;
import steed.util.base.PropertyUtil;

@Controller
@EnableAutoConfiguration
@Configuration
@ServletComponentScan(basePackages="steed")
//@ServletComponentScan(basePackageClasses={
//		SteedExtInitListener.class,
//		SessionListener.class,DinamicFilter.class,ContextFilter.class,AdminFilter.class,StrutsFilter.class})
public class App extends SpringBootServletInitializer implements EmbeddedServletContainerCustomizer {

	public static void main(String[] args) throws Exception {
		new UtilsUtil().initUtils();
//		BaseUtil.out(PropertyUtil.getConfig("devMode"));
		SpringApplication.run(App.class, args);
	}

	/*@Bean
	public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) {
		ServletRegistrationBean registration = new ServletRegistrationBean(dispatcherServlet);
		dispatcherServlet.setThrowExceptionIfNoHandlerFound(true);
		return registration;
	}
*/
	@Override
	public void customize(ConfigurableEmbeddedServletContainer container) {
		container.setPort(8088);
	}

}
